﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Tree.aspx.cs" Inherits="Tree" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Javascript/Library/JQuery/jquery-1.5.1.js" type="text/javascript"></script>
    <script src="Javascript/Test/JSLitmus.js" type="text/javascript"></script>
    <script type="text/javascript" src="Javascript/Test/qunit.js"></script>
    <script src="Javascript/Config/Tree/EdiorObject.js" type="text/javascript"></script>
    <script src="Javascript/Library/Utility/EventListener.js" type="text/javascript"></script>
    <script src="Javascript/Config/Tree/JSONManager.js" type="text/javascript"></script>
    <script src="Javascript/Library/Utility/Selector.js" type="text/javascript"></script>
    <script src="Javascript/Library/Tree/TreeManager.js" type="text/javascript"></script>
    <script src="Javascript/Library/Utility/CSSClassManager.js" type="text/javascript"></script>

    <style type="text/css">
    UL.jqueryFileTree {
	    font-family: Verdana, sans-serif;
	    font-size: 12px;
	    line-height: 18px;
	    padding: 0px;
	    margin: 0px;
	    
	    -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }

    UL.jqueryFileTree LI {
	    list-style: none;
	    margin: 0px;
	    white-space: nowrap;
	    
	    -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }

    UL.jqueryFileTree li {
        padding: 3px 0 2px 16px;
    }
    
    .expanded span.image {
        background: url("images/minus.gif") no-repeat scroll  0 5px transparent;
        cursor: pointer;
        height: 16px;
        width: 16px;
        float: left;
        margin-left:-16px;
        padding-right:16px;
        
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }
    
    .collapsed span.image {
        background: url("images/plus.gif") no-repeat scroll  0 5px transparent;
        cursor: pointer;
        height: 16px;
        width: 16px;
        float: left;
        margin-left:-16px;
        padding-right:16px;
    }
    
    .expanded span.text {
        background: url("images/folder_open.png") no-repeat 0 5px scroll transparent;
        cursor: pointer;
        height: 16px;
        margin-left: -16px;
        width: 16px;
        
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }
    
    .collapsed span.text {
        background: url("images/folder.png") no-repeat 0 5px scroll transparent;
        height: 16px;
        margin-left: -16px;
        width: 16px;
    }
    
    .collapsed span.text:hover {
        background: url("images/folder.png") no-repeat 0 5px scroll #BBDDFF;
    }
    
    .expanded span.text:hover {
        background: url("images/folder_open.png") no-repeat 0 5px scroll #BBDDFF;
    }
    
    UL.jqueryFileTree span.image {
        cursor:default;
    }
    
    UL.jqueryFileTree span.text {
        cursor: default;
        padding: 5px 5px 5px 20px;
    }
    
    .file span.text:hover {
        background: url("images/field.gif") no-repeat 0 5px scroll #BBDDFF;
    }
    
    .file span.text {
        background: url("images/field.gif") no-repeat 0 5px scroll transparent;
        margin-left:0px
        
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }
    
    </style>

    <script type="text/javascript">
        var treeNodeBind = null;
        treeNodeBind = new MainTree();
        function loadObject() {
            CreateDefaultJSON();
            treeNodeBind.TreeObj = GetSelectorObj("treeNode")[0];
            treeNodeBind.WO = document.getElementById("treeNode");
            treeNodeBind.JSON = EditorObject.GLOBAL_JSON;

            var RelativeJSON = treeNodeBind.LoadJSON("treeNode");
            treeNodeBind.LoadTree("treeNode", RelativeJSON);
        }

        function addTreeNode() {
            var workingOBJ = document.getElementById("treeNode.1.WB.8.T1.20");

            var JSON = '({' +
                                        "S0" + ': {'
                                                + EditorObject.sectionLookUpMap.ID + ': "S0",'
                                                + EditorObject.sectionLookUpMap.NAME + ': "Section1",'
                                                + EditorObject.sectionLookUpMap.HELP_TEXT_ID + ': "",'
                                                + EditorObject.sectionLookUpMap.SECURITY + ': "",'
                                                + EditorObject.sectionLookUpMap.UI_ORDER + ': "1",'
                                                + EditorObject.sectionLookUpMap.IS_TREE_OPEN + ': true,'
                                                + EditorObject.sectionLookUpMap.STATUS + ': "' + EditorObject.Status.New + '",'
                                                + EditorObject.Group.Control + ': {},'
                                                + EditorObject.Group.Grid + ': {' +
                                                                                    "G0" + ': {'
                                                                                                + EditorObject.gridLookUpMap.ID + ': "G0",'
                                                                                                + EditorObject.gridLookUpMap.NAME + ': "Grid1",'
                                                                                                + EditorObject.gridLookUpMap.HELP_TEXT_ID + ': "",'
                                                                                                + EditorObject.gridLookUpMap.UI_ORDER + ': "1",'
                                                                                                + EditorObject.gridLookUpMap.IS_TREE_OPEN + ': true,'
                                                                                                + EditorObject.gridLookUpMap.STATUS + ': "' + EditorObject.Status.New + '",'
                                                                                                + EditorObject.Group.Grid_HEADER + ': {},'
                                                                                                + EditorObject.Group.Grid_BODY + ': {},'
                                                                                                + EditorObject.Group.Grid_FOOTER + ': {}'
                                                                                            + '}'
                                                                                + '}'
                                               + '}'
                                   + '}'
                        + ')';
            var json = eval(JSON);

            treeNodeBind.AddNode(workingOBJ, json);
        }

        /*JSLitmus.test('Javascript Tree Test', function () {
            loadObject();
        });*/

        /*JSLitmus.test('Javascript Add Tree node Test', function () {
            addTreeNode();
        });*/

        /*function UnitTest() {
            test("a basic test example", function () {
                addTreeNode();
            });
        };*/
    </script>
</head>
<body>
    <div>

    <input type="button" value="Load" onclick="loadObject()"/>

    <input type="button" value="Add" onclick="addTreeNode()" />

    <input type="button" value="Test" onclick="UnitTest()" /> 

    <div id="treeNode"></div>

    </div>
</body>
</html>
